<!DOCTYPE html>
<html lang="en-US">
<title>Media Controls: play button accessibility tests</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../media-controls.js"></script>
<video controls></video>
<script>
async_test(t => {
  var video = document.querySelector('video');
  video.src = '../content/test.ogv';

video.oncanplaythrough = t.step_func_done(_ => {
    var play_button = enabledPlayButton(video);
    assert_not_equals(play_button, null);

    assert_equals(play_button.getAttribute('aria-label'), 'play');

    // Click play button.
    var coords = elementCoordinates(play_button);
    clickAtCoordinates(coords[0], coords[1]);
    video.onplay = t.step_func(_ => {
      assert_equals(play_button.getAttribute('aria-label'), 'pause');

      // Click pause button
      clickAtCoordinates(coords[0], coords[1]);
      video.onpause = t.step_func(_ => {
        assert_equals(play_button.getAttribute('aria-label'), 'play');
      });
    });
  });
});
</script>
</html>
